<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        .wrapper,
        .content {
            position: relative;
            width: 100%;
            z-index: 1;
        }

        .content {
            overflow-x: hidden;
        }

        .content .section {
            width: 100%;
            height: 100vh;
        }

        .content .section.hero {
            background-image: url(./images/photo-1589848315097-ba7b903cc1cc.avif);
            background-position: center center;
            background-repeat: no-repeat;
            background-size: cover;
        }

        .image-container {
            width: 100%;
            height: 100vh;
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            z-index: 2;
            perspective: 500px;
            overflow: hidden;
        }

        .image-container img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            object-position: center center;
        }
    </style>
</head>

<body>
    <div class="wrapper">
        <div class="content">
            <section class="section hero"></section>
            <section class="section gradient-purple"></section>
            <section class="section gradient-blue"></section>
        </div>
        <div class="image-container">
            <img src="./images/643312a6bc4ac122fc4e3afa_mainhome.webp" alt="image" />
        </div>
    </div>
</body>

<script src="https://unpkg.com/gsap@3/dist/gsap.min.js"></script>
<script src="https://unpkg.com/gsap@3/dist/ScrollTrigger.min.js"></script>
<script>
    console.clear();

    gsap.registerPlugin(ScrollTrigger);

    window.addEventListener("load", () => {
        gsap
            .timeline({
                scrollTrigger: {
                    trigger: ".wrapper",
                    start: "top top",
                    end: "+=150%",
                    pin: true,
                    scrub: true,
                    markers: true
                }
            })
            .to("img", {
                scale: 2,
                z: 350,
                transformOrigin: "center center",
                ease: "power1.inOut"
            })
            .to(
                ".section.hero",
                {
                    scale: 1.1,
                    transformOrigin: "center center",
                    ease: "power1.inOut"
                },
                "<"
            );
    });

</script>

</html>